import java.util.*;

public class Main22 {
	public static int n;
    public static int m;
    public static Map<Integer, Integer> hash;
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        n = in.nextInt();
        m = in.nextInt();
        hash = new HashMap<>();
        int hashMax = 0;
        int[] a = new int[n];
        for(int i = 0; i < n; i++) {
            a[i] = in.nextInt();
            hash.put(a[i], hash.getOrDefault(a[i], 0) + 1);
            hashMax = Math.max(hashMax, hash.get(a[i]));
        }
        
        if(hash.size() > m) {
            System.out.println(-1);
        } else {
            int l = 1;
            int r = hashMax;
            while(l < r) {
                int mid = (l + r) / 2;
                if(check(mid)) {
                    r = mid;
                } else {
                    l = mid + 1;
                }
            }
            System.out.println(r);
        }
    }
    
    public static boolean check(int x) {
        int sum = 0;
        for(int a : hash.values()) {
            sum += a / x + (a % x == 0 ? 0 : 1);
        }
        if(sum > m) {
            return false;
        }else {
            return true;
        }
    }
}